package koction.model.admin;

import java.util.List;

import javax.annotation.Resource;

import koction.model.consumer.ConsumerVO;
import koction.model.product.ProductVO;
import koction.model.question.QuestionBoardVO;
import koction.model.seller.SellerVO;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class AdminDaoImpl implements AdminDao {
	@Resource(name="sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public AdminVO adminLogin(AdminVO avo) {
		return this.sqlSessionTemplate.selectOne("admin.adminLogin",avo);
	}

	@Override
	public List<AskSellerVO> responseSellerView() {
		return this.sqlSessionTemplate.selectList("admin.responseSellerView");
	}

	@Override
	public void registerSeller(AskSellerVO asvo) {
		this.sqlSessionTemplate.insert("admin.registerSeller",asvo);
	}

	@Override
	public void deleteAskSeller(AskSellerVO asvo) {
		this.sqlSessionTemplate.delete("admin.deleteAskSeller",asvo);
	}

	@Override
	public List<ConsumerVO> getAllConsumerList() {
		return this.sqlSessionTemplate.selectList("admin.getAllConsumerList");
	}

	@Override
	public SellerVO findSellerByConsumerId(String id) {
		return this.sqlSessionTemplate.selectOne("seller.findSellerByConsumerId", id);
	}

	@Override
	public List<SellerVO> getAllSellerList() {
		return this.sqlSessionTemplate.selectList("admin.getAllSellerList");
	}

	@Override
	public void responseSellerCancle(String id) {
		this.sqlSessionTemplate.delete("admin.responseSellerCancle",id);
	}
	@Override
	public List<ProductVO> adminGetProductList() {
		return this.sqlSessionTemplate.selectList("admin.adminGetProductList");
	}

	@Override
	public List<ProductVO> adminGetSalesVolumeList() {
		return this.sqlSessionTemplate.selectList("admin.adminGetSalesVolumeList");
	}

	@Override
	public List<ProductVO> adminGetSalesProfitList() {
		return this.sqlSessionTemplate.selectList("admin.adminGetSalesProfitList");
	}

	@Override
	public List<ProductVO> findProductName(String productName) {
		return this.sqlSessionTemplate.selectList("admin.findProductName",productName);
	}
	
	@Override
	public List<QuestionBoardVO> getQuestionBoard() {
		return this.sqlSessionTemplate.selectList("admin.getQuestionBoard");
	}

	@Override
	public void deleteBoard(int no) {
		 this.sqlSessionTemplate.delete("admin.deleteBoard");
		
	}

	@Override
	public List<ProductVO> salesVolumeContentView(String sellerId) {
		return this.sqlSessionTemplate.selectList("admin.salesVolumeContentView", sellerId);
	}

	@Override
	public List<ProductVO> salesPriceContentView(String sellerId) {
		return this.sqlSessionTemplate.selectList("admin.salesPriceContentView", sellerId);
	}

}
